$OpenBSD: patch-sapi_cgi_cgi_main_c,v 1.2 2015/02/19 20:14:41 sthen Exp $
--- sapi/cgi/cgi_main.c.orig.port	Wed Feb 18 15:39:54 2015
+++ sapi/cgi/cgi_main.c	Thu Feb 19 14:23:08 2015
@@ -1746,6 +1746,7 @@ int main(int argc, char *argv[])
 	char *orig_optarg = php_optarg;
 	char *script_file = NULL;
 	int ini_entries_len = 0;
+	char *ini;
 	/* end of temporary locals */
 
 #ifdef ZTS
@@ -1800,7 +1801,12 @@ int main(int argc, char *argv[])
 
 	sapi_startup(&cgi_sapi_module);
 	fastcgi = fcgi_is_fastcgi();
-	cgi_sapi_module.php_ini_path_override = NULL;
+
+	if ((ini = getenv("PHP_INI_PATH"))) {
+		cgi_sapi_module.php_ini_path_override = ini;
+	} else {
+		cgi_sapi_module.php_ini_path_override = NULL;
+	}
 
 #ifdef PHP_WIN32
 	_fmode = _O_BINARY; /* sets default for file streams to binary */
